/**
 * 
 */
package com.bitBusy.manageyourriches.utilityClasses.dialogboxes;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;

import com.bitBusy.manageyourriches.R;

/**
 * Class for dialog box with edit text
 * @author SumaHarsha
 *
 */
public class DialogWithEditText extends BasicDialogBox {

	
	/** this object's View*/
	private View myView;
	
	/**this object's text*/
	private String myText;
	
		/** Method to throw open the dialog box*/
	public void throwOpen()
	{
		if (currActivity != null && builder != null)
		{
			LayoutInflater inflater = LayoutInflater.from(currActivity);
			View dialogView = inflater.inflate(R.layout.dialog_with_edittext, null);
			myView = dialogView; 
			builder.setView(dialogView);
			showDialog();
		}
		else
		{
			throw new NullPointerException("Null pointer - cannot open dialog box!");
		}
	}
	
	/**Method to set text*/
	public void setText()
	{
		if (myView != null)
		{
			final EditText userInput = (EditText) myView
						.findViewById(R.id.editTextDialogUserInput);
			if (userInput != null)
			{
				myText = userInput.getText().toString();
				
			}
		}
	}
	
	/**Method to get text*/
	public String getText()
	{
		return myText;
	}
	
}
